<?php
declare (strict_types=1);

namespace app\admin\controller;

use think\App;
use think\facade\View;
use app\common\model\Area;
use app\common\facade\Builder;
use think\exception\ValidateException;

class CateCensus extends Base
{

    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\CateCensus';

    //关联模型
    protected array $hasOne = ['cate1'];

    public function index(): string
    {
        return Builder::Table()
            ->addColumn(['type' => 'checkbox', 'fixed' => 'left', 'title' => '全选'])
            ->addColumn(['field' => 'id', 'title' => '订单ID', 'width' => 90])
            ->addColumn(['field' => 'cate', 'title' => '装修类型', 'templet' => '<div>{{d.cate1.title}}</div>',])
            ->addColumn(['field' => 'amount', 'title' => '金额'])
            ->addColumn(['field' => 'num', 'title' => '数量'])
            ->fetch();
    }

}
